<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <home></home>
  </div>
  <script src="./vue.js"></script>
  <script>
    // 创建子组件组件对象
    const CommonHead = {
      template:`
        <div>
          <h3>头部</h3>  
          <slot name="a"/>
          <h3>尾部</h3>
          <slot name="b"/>
        </div>
      `
    }
    // 定义父组件
    const Home = {
      template: `
        <div>
          <h2>首页</h2>  
          <hr/>
          <common-head>
            <div slot="a">
              <button>父组件传入的内容</button>  
              <i>父组件传入的内容2</i>  
            </div>  
            <div slot="b">
              <h3>这是另一个结构</h3>
            </div> 
          </common-head>
        </div>
      `,
      components: {
        CommonHead
      }
    }
    
    Vue.component('Home', Home);
    
    const vm = new Vue({
      // vm功能将vue语法渲染到 视图
      el: '#app'
    })
  </script>
</body>
</html>